//
//  commModel.m
//  YiXiu
//
//  Created by yixiu on 16/7/22.
//  Copyright © 2016年 zzz. All rights reserved.
//

#import "CommModel.h"

@implementation CommModel
//单元格的总体高度
- (CGFloat)totalHeight{
    
    return KScreenHeight -64-44;
}


////根据字体和字数确定文字text的尺寸
//- (CGSize)contentTextSize{
//    
//    return CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20, [self sizeOfString:self.contentText font:self.contentTextFont].height + 3);
//}
//
//
////根据图片的数量来确定尺寸
//- (CGSize)contentImageSize{
//    
//    CGSize size = CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20, 1);
//    CGFloat gap = (WidthOfView([UIScreen mainScreen]) - 20)/3.0;
//    if (self.contentImages.count > 6) {
//        
//        size = CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20, gap * 3);
//        
//    }else if (self.contentImages.count > 3){
//        
//        size = CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20, gap * 2);
//        
//    }else if (self.contentImages.count > 0){
//        
//        size = CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20, gap * 1);
//    }else if (self.contentImages.count == 0){
//        
//        size = CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20,  1);
//        
//    }
//    return size;
//}


//根据传入text的字体和数量计算其高
- (CGSize)sizeOfString:(NSString *)str font:(UIFont *)font{
    
    NSMutableDictionary * dic = [NSMutableDictionary dictionary];
    dic[NSFontAttributeName] = font;
    CGRect rect = [str boundingRectWithSize:CGSizeMake(WidthOfView([UIScreen mainScreen]) - 20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size;
}



@end
